﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CLFramework.EnvironmentCheck.CheckItems
{
    public class ExcelExport : ICheckItem
    {
        public int Order
        {
            get { return 4; }
        }

        public string Name
        {
            get { return "Excel报表导出"; }
        }

        public string Remarks
        {
            get {

                bool ok = result;
                if (!check)
                {
                    ok = Result;
                }

                if (ok)
                    return "";
                else
                    return "请安装Office Excel 2003或以上版本";
            }
        }

        public bool Must
        {
            get { return true; }
        }

        private bool result = false;
        private bool check = false;
        public bool Result
        {
            get
            {
                if (!check)
                {
                    result = isExcelInstalled();
                }
                return result;
            }
        }


        bool isExcelInstalled()
        {
            Type type = Type.GetTypeFromProgID("Excel.Application");
            return type != null;
        }
    }
}
